 {extend name="extra@admin/content"}
{block name="content"}
<form class="layui-form layui-box" style='padding:25px 30px 20px 0' action="__SELF__" data-auto="true" method="post">

    <div class="layui-form-item">
        <label class="layui-form-label">等级名称</label>
        <div class="layui-input-block">
            <input name="title" value='{$lerve.title}' required="required" 
                   title="等级名称" class="layui-input">
        </div>
    </div>
    <div class="layui-form-item">
        <label class="layui-form-label">等级积分</label>
        <div class="layui-input-block">
            <input name="score" value='{$lerve.score}' required="required" 
                   title="请输入积分" class="layui-input">
        </div>
    </div>
    <div class="layui-form-item">
        <label class="layui-form-label">商品简介</label>
        <div class="layui-input-block">
            <textarea placeholder="请输入等级简介不超过100个字符" maxlength="100" title="请输入等级简介" class="layui-textarea" name="detail" value="{$lerve.detail}"></textarea>
        </div>
    </div>
    <div class="layui-form-item">
        <label class="layui-form-label">上传图片</label>
            <div class="uploadimage"><input type="hidden" name="logo" {if $lerve and !empty($lerve.logo)} value="{$lerve.logo}" {/if} /></div>
            <a data-file="one" data-field="logo" data-type="png,jpg,jpeg" data-uptype="qiniu" href="javascript:void(0)"
               class="uploadbutton">上传图片</a>
            {if $lerve and !empty($lerve.logo)}
            <script>
                $(function(){
                    var img = "{$lerve.logo}";
                    require(['jquery'], function () {
                        $('[name="logo"]').parent().attr('data-tips-image', this.value).css('backgroundImage', 'url(' + img + ')');
                    });
                });
            </script>
            {/if}
            <script>
                require(['jquery'], function () {
                    $('[name="logo"]').on('change', function () {
                        $(this).parent().attr('data-tips-image', this.value).css('backgroundImage', 'url(' + this.value + ')');
                    });
                });
            </script>
    </div>
    <input type="hidden" name="id" value='{$lerve.id}'>

    <div class="hr-line-dashed"></div>
    <div class="layui-form-item text-center">
        <button class="layui-btn" type='submit'>保存数据</button>
        <button class="layui-btn layui-btn-danger" type='button' data-confirm="确定要取消编辑吗？" data-close>取消编辑</button>
    </div>

    <script>window.form.render();</script>
</form>
{/block}

